//
//  CalendarEventViewModel.m
//  AccessSystemCalendar
//
//  Created by Felix Yin on 2017/3/20.
//  Copyright © 2017年 Felix Yin. All rights reserved.
//

#import "CalendarEventViewModel.h"
#import "CalendarEventModel.h"

NSString * const EVENT_ID = @"eventID";

NSString * const EVENT_TITLE = @"title";

NSString * const EVENT_LOCATIONSTR = @"locationStr";

NSString * const EVENT_STARTDATE = @"startDate";

NSString * const EVENT_ENDDATE = @"endDate";

NSString * const EVENT_EVENTNOTES = @"eventNotes";

NSString * const EVENT_ALARMTIME = @"alarmTime";

@implementation CalendarEventViewModel

- (instancetype)initWithModel:(CalendarEventModel *)eventModel{
    self = [super init];
    _eventID = eventModel.eventID;
    _eventTitle = eventModel.eventTitle;
    _locationStr = eventModel.eventLocation;
    _eventStartDate = [NSString stringWithFormat:@"%@",eventModel.eventStartDate];
    _eventEndDate = [NSString stringWithFormat:@"%@",eventModel.eventEndDate];
    _eventNotes = eventModel.eventNotes;
    return self;
}

- (instancetype)initWithDict:(NSDictionary *)eventDict{
    self = [super init];
    _eventID = eventDict[EVENT_ID];
    _eventTitle = eventDict[EVENT_TITLE];
    _locationStr = eventDict[EVENT_LOCATIONSTR];
    _eventStartDate = eventDict[EVENT_STARTDATE];
    _eventEndDate = eventDict[EVENT_ENDDATE];
    _eventNotes = eventDict[EVENT_EVENTNOTES];
    _alarmTime = eventDict[EVENT_ALARMTIME];
    return self;
}

@end
